/*
 * @lc app=leetcode.cn id=258 lang=csharp
 *
 * [258] 各位相加
 */

// @lc code=start
public class Solution {
    public int AddDigits(int num) {
        while(num > 9)
        {
            int temp = 0;
            while(num > 0)
            {
                temp += num % 10;
                num /= 10;
            }
            num = temp;
        }
        return num;
    }
}
// @lc code=end

